<div id="stock-list">
	<div class="title">库存单列表</div>
	<div class="tools">
		<div class="search">
			<form name="search" method="get" action="<?php echo $site['root'] . 'stock/lst/' ?>">
			<span>开始日期</span><input class="date jdper" type="text" name="start_date" value="<?php echo isset($search['start_date'])?$search['start_date']:'' ?>" />
			<span>结束日期</span><input class="date jdper" type="text" name="end_date" value="<?php echo isset($search['end_date'])?$search['end_date']:'' ?>" />
			<span>备注</span><input class="description" type="text" name="description" value="<?php echo isset($search['description'])?$search['description']:'' ?>" /><br />
			<span>出入库</span><select name="stock_type">
				<option value="all" <?php if('all'==$search['stock_type']): ?>selected="selected"<?php endif ?>>所有</option>
				<option value="inbound" <?php if('inbound'==$search['stock_type']): ?>selected="selected"<?php endif ?>>入库</option>
				<option value="outbound" <?php if('outbound'==$search['stock_type']): ?>selected="selected"<?php endif ?>>出库</option>
				<option value="transfer" <?php if('transfer'==$search['stock_type']): ?>selected="selected"<?php endif ?>>调仓</option>
			</select>
			<span>系统类型</span><select name="bound_type_flg">
				<option value="all">所有</option>
				<?php if(isset($form['bound_type_flg'])): ?>
					<?php foreach($form['bound_type_flg'] as $value=>$name): ?>
				<option value="<?php echo $value ?>" class="added-option" <?php if($search['bound_type_flg']==$value): ?>selected="selected"<?php endif ?>><?php echo $name ?></option>
					<?php endforeach ?>
				<?php endif ?>
			</select>
			<span>类型</span><select name="bound_type_id">
				<option value="all">所有</option>
				<?php if(isset($form['bound_type_id'])): ?>
					<?php foreach($form['bound_type_id'] as $value=>$name): ?>
				<option value="<?php echo $value ?>" class="added-option" <?php if($search['bound_type_id']==$value): ?>selected="selected"<?php endif ?>><?php echo $name['name'] ?></option>
					<?php endforeach ?>
				<?php endif ?>
			</select>
			<input class="btn" type="submit" value="查询" />
			</form>
		</div>
	</div>
	<div class="content">
		<div class="list-top">
			<div class="number col">编号</div>
			<!--<div class="store">仓位</div>-->
			<div class="stock_type col">出入库</div>
			<div class="bound_type col">类型</div>
			<div class="person col">操作人</div>
			<div class="desc col">摘要</div>
			<div class="date col">日期</div>
			<div class="date col">创建日期</div>
		</div>
		<div class="list-content">
			<?php if (empty($stocks)): ?>
			<div class="empty">呃，似乎没有结果啊 XP 。更换条件重试下 :D</div>
			<?php endif ?>
			<?php foreach ($stocks as $stock): ?>
			<div class="each<?php if(1 == $stock->del_flg){echo ' deleted';}?><?php if(1 == $stock->balance_flg){echo ' balanced';} ?>" stock-id="<?php echo $stock->stock_id ?>">
				<div class="number col"><?php echo $stock->stock_number; ?></div>
				<div class="stock_type col"><?php echo $stock->stock_type; ?></div>
				<div class="bound_type col">
					<?php
					if (0 == $stock->bound_type_id):
						echo '调仓';
					elseif ('inbound' == $stock->stock_type):
						echo $inbound_types[$stock->bound_type_id]['sys_name'] . '[' . $inbound_types[$stock->bound_type_id]['name']  . ']';
					elseif ('outbound' == $stock->stock_type):
						echo $outbound_types[$stock->bound_type_id]['sys_name'] . '[' . $outbound_types[$stock->bound_type_id]['name']  . ']';
					endif
					?>
				</div>
				<div class="person col"><?php echo $stock->stock_realname; ?></div>
				<div class="desc col"><?php echo $stock->description; ?></div>
				<div class="date col"><?php echo date('Y/m/d', $stock->stock_date); ?></div>
				<div class="date col"><?php echo date('Y/m/d', $stock->create_date); ?></div>
				<?php if (0 == $stock->del_flg && 0 == $stock->balance_flg): ?>
				<div class="action del hide">撤</div>
				<?php endif ?>
			</div>
			<?php endforeach ?>
		</div>
	</div>
	<div class="tools bottom-tools">
		<div class="pages">
			<?php echo $page_show; ?>
		</div>
		<div class="count-info">当前<?php echo $page ?>/<?php echo $page_count; ?>页 共<?php echo $count; ?>条</div>
	</div>
	<input id="inbound_types" type="hidden" value="">
	<input id="inbound_sys_types" type="hidden" value="">
	<input id="outbound_types" type="hidden" value="">
	<input id="outbound_sys_types" type="hidden" value="">
</div>

<script type="text/javascript">
$(function(){
	$('.jdper').jDatepicker();
	main.stock_retext();
	stock.list.init();
})
</script>